package com.flashshe.utils
{
	public class ObjectUtil
	{
		import com.flashshe.ds.IComparable;
		
		
		
		public static function equals(o1:Object, o2:Object):Boolean
		{
			if (isSimple(o1) && isSimple(o2))
			{
				return o1 === o2;
			}
			else if (IComparable(o1) && IComparable(o2))
			{
				return IComparable(o1).compareTo(o2) == 0;
			}
			else
			{
				throw new Error(o1 + "无法与" + o2 + "进行比较");
			}
			
			return false;
		}		
		
		public function ObjectUtil()
		{
		}
		
		// 检测value是否是 数字，字符串，布尔值
		private static function isSimple(value:Object):Boolean
		{
			var type:String = typeof(value);
			switch (type)
			{
				case "number":
				case "string":
				case "boolean":
				{
					return true;
				}
			}
			
			return false;
		}
	}
}